FlyTalk.views.ServicesView = Ext.extend(Ext.Panel, {
    initComponent: function () {
		
    	this.backButton = new Ext.Button({
		
			iconCls: 'home',
			iconMask: true,
			handler: this.backButtonTap,
			scope: this
		});
    	
		this.toolbar = new Ext.Toolbar({
			title: 'Services',
			doc: 'top',
			layout: 'hbox',
			items: [
			    this.backButton,
				{xtype: 'spacer'},
				//this.composeButton,
			]
		});
		
		this.dockedItems = [this.toolbar];
		
		Ext.regModel('ServiceModel', {
			fields: [
				{name: 'service', type: 'string'}
			]
		});
		
		this.serviceStore = new Ext.data.Store({
			model : 'ServiceModel',
			autoLoad: true,

			proxy: {
          		type: 'localstorage',
        		id: 'service-store'
    		},
			
			data: [
				{service: 'Airport facilities'},
				{service: 'Baggage lockers'},
				{service: 'Buses'},
				{service: 'Bank'},
				{service: 'Car hire'},
				{service: 'Panorama Terrace'},
				{service: 'Post Office'},
			],
		});
			
		this.list = new Ext.List({
			itemTpl : '{service}',
			store: this.serviceStore,
			scroll: true,
			fullscreen: true,
			listeners:{
				itemTap: function(dv, index, tweet, evt){
					alert("work in progress");			
				},
			}			
		});

	
		this.items = [this.list];
		
		FlyTalk.views.ServicesView.superclass.initComponent.call(this);
        
    },
    
    backButtonTap: function () {
        Ext.dispatch({
            controller: FlyTalk.controllers.ftController,
            action: 'openHome'
        });
    },

});